#!/bin/sh

errorExit() {
    echo "*** $*" 1>&2
    exit 1
}

curl --silent --max-time 2 --insecure https://localhost:{{APISERVER_DEST_PORT}}/ -o /dev/null || errorExit "Error GET https://localhost:{{APISERVER_DEST_PORT}}/"
if ip addr | grep -q {{virtual_ipaddress}}; then
    curl --silent --max-time 2 --insecure https://{{virtual_ipaddress}}:{{ APISERVER_DEST_PORT }}/ -o /dev/null || errorExit "Error GET https://{{virtual_ipaddress}}:{{APISERVER_DEST_PORT}}/"
fi
